

//显示模板图的模态框
var showModelPic = function () {
    if ($(this).attr('four_img') == '')
        return;
    var url ="http://gxj.ngrok.xiaomiqiu.cn/Content/Images/pdf/"+$(this).attr('four_img');
    location.href="../page/PdfView?url="+url;

};



function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return (r[2]); return null;
}


//初始加载提交材料
window.onload = function () {
    $.post("../Index/checkAllTemp",null, function (res)
    {
        var title=decodeURI(GetQueryString("title"));//decodeURI()将中文转换成字符串
        document.getElementById("titleName").innerHTML = title;
        var testJson = eval(res);
        if (testJson.length >1)
        {
                for (var i = 0; i < testJson.length; i++) {
                    $("#List").append(
                        "<button style='float: left'  id='ytModel' class='seca' data-modellink='true'  four_img='"+testJson[i]["FOUR_IMG"]+"'  ><img style='width: 58px' src='../Content/Images/lode.jpg'> </img></button>" +
                        "<label class='weui-cell weui-check__label' for='" + testJson[i]["FOUR_ID"] + "'>" +
                        "<div class='weui-cell__bd'>" +
                        "<p >" + testJson[i]["FOUR_NAME"] + "</p>" +
                        "</label>"
                    );
                }
                $("button[data-modelLink]").on("click", showModelPic);

        }else {
            alert(testJson[0]["failInfo"]);
        }

    });

};



